using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
using Matrix.Configuration.Telemetry;

namespace Matrix.Configuration
{
    [DependsOn(
        typeof(MatrixConfigurationApplicationModule),
        typeof(MatrixConfigurationApplicationContractsModule),
        typeof(AbpAspNetCoreMvcModule)
    )]
    public class MatrixConfigurationHttpApiModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();

            // ABP自动约定控制器配置 - 为Application创建默认路由
            Configure<AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers.Create(typeof(MatrixConfigurationApplicationModule).Assembly);
            });

            // 注意：OpenTelemetry在Host层配置，这里暂不注册
            // context.Services.AddMatrixOpenTelemetry(configuration);
        }
    }
}